(function () {
    'use strict';

    angular
        .module('logcenterApp')
        .service('questionCountService',questionCountService);

    questionCountService.$inject=['$http','$q'];
    function questionCountService($http,$q) {

        var querySlowServiceOrCommTop10 = function (partition, logmsg,beginDateTime, endDateTime,code,active) {
            var deferred=$q.defer();
            $http.get('api/dashboard/slowServiceOrCommTop10?partition=' + partition+"&logmsg="+logmsg
                + '&startTime='+ beginDateTime + '&endTime=' + endDateTime+"&code="+code+"&active="+active).then(function (resp) {
                deferred.resolve(resp.data);
            },function (error) {
                deferred.reject(error);
            });
            return deferred.promise;
        };
        var querySlowSqlTop10= function (partition, uid,beginDateTime, endDateTime,code,active) {
            var deferred=$q.defer();
            $http.get('api/dashboard/slowSqlTop10?partition=' + partition+"&uid="+uid
                + '&startTime='+ beginDateTime + '&endTime=' + endDateTime+'&code='+code+'&active='+active).then(function (resp) {

                deferred.resolve(resp.data);
            },function (error) {
                deferred.reject(error);
            });
            return deferred.promise;
        };

        return {
            querySlowServiceOrCommTop10:querySlowServiceOrCommTop10,
            querySlowSqlTop10:querySlowSqlTop10

        };
    }
})();
